﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Txt2PajekLarge
{
    public class Edge:Object
    {
        private long[] _lNodePair=new long[2];
        private double _dWeight = 1;

        public Edge() { }

        public Edge(long lSourceNode, long lTargetNode, double dWeight)
        {
            _lNodePair[0] = lSourceNode;
            _lNodePair[1] = lTargetNode;
            _dWeight = dWeight;
        }

        public long[] NodePair
        {
            get { return _lNodePair; }
            set { _lNodePair[0] = value[0]; _lNodePair[1] = value[1]; }
        }

        public long SourceNode
        {
            get { return _lNodePair[0]; }
            set { _lNodePair[0] = value; }
        }

        public long TargetNode
        {
            get { return _lNodePair[1]; }
            set { _lNodePair[1] = value; }
        }

        public double Weight
        {
            get { return _dWeight; }
            set { _dWeight = value; }
        }

        public override bool Equals(Object obj)
        {
            //Check for null and compare run-time types.
            if (obj == null || GetType() != obj.GetType()) return false;
            Edge e = (Edge)obj;
            return (this.SourceNode == e.SourceNode) && (this.TargetNode == e.TargetNode) && (this.Weight==e.Weight);
        }
    }
}
